package com.siwei.mes.enums;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Description: 物料类型枚举   字典表（MASTERIAL_TYPE）
 * @Version: 1.0
 * @author: chenmaolin
 * @date: 2023/12/23 22:16
 */
@Getter
public enum WarningEnum {
    FORMAL("FORMAL_TEST_CONFIG", "型式检验配置"),
    DOUBLE("DOUBLE_TEST_CONFIG", "复式检验配置"),
    SUPPLIER("SUPPLIER_COMPANY_CERTIFICATE_CONFIG", "供应商备案证配置"),
    CERTIFICATE("USER_CERTIFICATE_CONFIG", "证书预警"),
    WARRANTY("USER_WARRANTY_CONFIG", "质保书提醒");

    @ApiModelProperty(value = "类型code")
    private String code;

    @ApiModelProperty(value = "预警名称")
    private String name;


    WarningEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code查找信息
     *
     * @return
     */
    public static WarningEnum selectByCode(String code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
